var t,
  a = require("../../@babel/runtime/helpers/defineProperty"),
  i = require("../../res/www.a9a.cn.js"),
  o = getApp();
Page({
  data: {
    IFMY: !1,
    nTitle: "我的推广中心",
    btm_nav: "my",
    btmnavbg_color: "#B8BCCC",
    btmnavbg_rgbcolor: i.c16_rgb("#B8BCCC"),
    mask_class: "alpha0_100",
    div_myinfo_form: !1,
  },
  onLoad: function (t) {
    var a = this,
      n = this,
      e = 0,
      s = 0;
    o.get_config("_ZEAI").then(function (t) {
      n.setData({ color: o._ZEAI.color, rgbcolor: i.c16_rgb(o._ZEAI.color) });
    }),
      (i.ifint(t.tguid) || i.ifint(t.admid)) &&
        ((e = i.ifint(t.tguid) ? t.tguid : 0),
        (s = i.ifint(t.admid) ? t.admid : 0)),
      n.setData({ tguid: e, admid: s }),
      o.get_openid().then(function (t) {
        a.init();
      });
  },
  init: function () {
    var a = this;
    wx.showNavigationBarLoading(),
      (t = wx.getStorageSync("COOK_U")),
      o.ajax({
        url: "tg.php",
        data: {
          submitok: "MY",
          openid: t.openid,
          tguid: a.data.tguid,
          admid: a.data.admid,
        },
        success: function (t) {
          switch ((wx.hideNavigationBarLoading(), t.flag)) {
            case "1":
            case 1:
              var o = t.D.color;
              a.setData({
                IFMY: !0,
                nTitle: t.nTitle,
                D: t.D,
                MB: t.MB,
                btm_nav_msg_num: t.btm_nav_msg_num,
              }),
                wx.setNavigationBarColor({
                  backgroundColor: o,
                  frontColor: "#ffffff",
                }),
                wx.setNavigationBarTitle({ title: t.nTitle }),
                wx.setBackgroundColor({ backgroundColorTop: o });
              break;
            case "flag0":
            case "flag_1":
            case "flag2":
              wx.reLaunch({ url: "reg?t=" + t.flag });
              break;
            default:
              (t.this = a), (t.url = "no"), i.sorry(t);
          }
        },
      });
  },
  onPullDownRefresh: function () {
    var t = this;
    wx.vibrateShort({ type: "heavy" }),
      setTimeout(function () {
        wx.stopPullDownRefresh(), t.init();
      }, 500);
  },
  back: function () {
    this.setData({ div_login: !1 });
  },
  copywxFn: function (t) {
    i.copy_text({ data: this.data.OUT.weixin, msg: "复制成功" });
  },
  mask_closeFn: function (t) {
    var i = this,
      o = t.currentTarget.dataset.maskid;
    this.setData({
      mask_class: "alpha100_0",
      div_outlist_box_class: "div_upAnm2",
    }),
      setTimeout(function () {
        var t;
        i.setData(
          (a((t = {}), o, !1),
          a(t, "mask_class", "alpha0_100"),
          a(t, "div_outlist_box_class", "div_upAnm1"),
          t)
        );
      }, 500);
  },
  emptyFn: function () {},
  vipFn: function () {
    i.empty(this.data.MB) || o.openSetting(this.data.MB),
      wx.navigateTo({ url: "my_vip" });
  },
  my_infoFn: function () {
    this.setData({ div_myinfo_form: !0 });
  },
  my_info_closeFn: function () {
    this.setData({ div_myinfo_form: !1 });
  },
  my_info_photo_s_addFn: function () {
    var n = this;
    wx.chooseMedia({
      count: 1,
      mediaType: ["image"],
      sourceType: ["album", "camera"],
      sizeType: ["compressed"],
      success: function (e) {
        n.setData({ photo_s: e.tempFiles[0].tempFilePath }),
          wx.uploadFile({
            url: o.WWW + "/api/wxxcx/tg.php",
            filePath: e.tempFiles[0].tempFilePath,
            name: "pic",
            formData: { submitok: "myinfo_photo_s_up", openid: t.openid },
            success: function (t) {
              var o;
              1 == (t = i.jsoneval(t.data)).flag
                ? n.setData(
                    (a((o = {}), "D.cook_tg_photo_s", t.cook_tg_photo_s),
                    a(o, "photo_s_dbname", t.dbname),
                    o)
                  )
                : wx.showModal({
                    content: t.msg,
                    confirmColor: n.data.color,
                    confirmText: "朕知道了",
                    showCancel: !1,
                    success: function (t) {},
                  });
            },
          });
      },
    });
  },
  myinfo_form_submitFn: function (a) {
    var n = this,
      e = a.detail.value;
    o.ifweixin(e.weixin)
      ? o.empty(e.nickname)
        ? wx.showToast({ title: "请输入【网名昵称】", icon: "none", mask: !0 })
        : o.ajax({
            url: "tg.php",
            data: {
              submitok: "myinfo_modupdate",
              openid: t.openid,
              weixin: e.weixin,
              nickname: e.nickname,
              photo_s: e.photo_s,
            },
            success: function (t) {
              wx.hideLoading(),
                1 == t.flag
                  ? (n.setData({ div_myinfo_form: !1 }), n.onPullDownRefresh())
                  : ((t.this = n), (t.url = "no"), i.sorry(t));
            },
          })
      : wx.showToast({ title: "请输入【微信或手机】", icon: "none", mask: !0 });
  },
  tghbFn: function () {
    i.empty(this.data.MB) || o.openSetting(this.data.MB),
      wx.navigateTo({ url: "my_ewm?tguid=" + this.data.D.cook_tg_id });
  },
  onShareAppMessage: function (t) {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      path: "/pages/tg/my",
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      query: "",
      path: "/pages/tg/my",
    };
  },
});
